package com.yunhe.marketing.client.fallback;

import com.yunhe.marketing.client.ItemClient;
import com.yunhe.common.model.ResultObject;
import com.yunhe.common.util.FallbackUtil;
import feign.hystrix.FallbackFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

/**
 * @Author: DongWenYu
 * @Date: 2021/3/1 16:08
 */
@Component
public class ItemClientFallbackFactory implements FallbackFactory<ItemClient> {

    @Override
    public ItemClient create(Throwable arg0) {
        return new ItemClient() {

            @Override
            public ResponseEntity<ResultObject> getItemByItemCodeAndEnumName(String name) {
                return FallbackUtil.getDefaultFallBack();
            }
        };
    }
}
